package com.lean.android.projecttemplate.startup

import android.content.Context
import androidx.startup.Initializer
import com.lean.android.ad.core.AdSdk
import com.lean.android.ad.core.config.AdConfig
import com.lean.android.cache.CacheInitializer
import com.lean.android.projecttemplate.BuildConfig
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
import timber.log.Timber

class AppInitializer : Initializer<Unit>, KoinComponent {

    private val adConfig by inject<AdConfig>()

    override fun create(context: Context) {
        Timber.d("init app components.")
        AdSdk.debug = BuildConfig.DEBUG
        AdSdk.init(context, adConfig)
    }

    override fun dependencies(): List<Class<out Initializer<*>>> {
        return listOf(KoinInitializer::class.java, CacheInitializer::class.java)
    }

}